package main

import "fmt"

func main() {
	arr := []int{4, 5, 1, 6, 2, 7, 3, 8}
	fmt.Println(GetLeastNubers_Solution(arr, 4))

}

func GetLeastNubers_Solution(input []int, k int) []int {

	leastNumber := make([]int, k)
	if k > len(input) {
		return nil
	}

	for i := 0; i < len(input); i++ {
		for j := i + 1; j < len(input); j++ {
			if input[i] > input[j] {
				input[i], input[j] = input[j], input[i]

			}
		}
	}
	leastNumber = input[:k]
	return leastNumber

}
